import sg2py
import sys, getopt


def main(argvs):
    argv = {'suit_case_dir': '', 'output_dir': 'output/'}
    try:
        opts, args = getopt.getopt(argvs[1:], "ho:s:")
    except getopt.GetoptError:
        print('test.py -o <output_dir> -s <suitcase_dir> file')
        sys.exit(2)
    argv['filename'] = args[0]
    for opt, arg in opts:
        if opt == '-h':
            print('test.py -o <output_dir> -s <suitcase_dir> file')
            sys.exit()
        elif opt == "-s":
            argv['suit_case_dir'] = arg
        elif opt == "-o":
            argv['output_dir'] = arg
    return argv


if __name__ == "__main__":
    argv = main(sys.argv)
    tmp = sg2py.get_swagger(argv['filename'])
    sg2py.swagger2py(tmp, argv['output_dir'], argv['suit_case_dir'])
